//
//  JSPreviewManager.m
//  JigSaw
//
//  Created by Slim Wang on 15/2/4.
//  Copyright (c) 2015年 LITB. All rights reserved.
//

#import "JSPreviewManager.h"

@implementation JSPreviewManager

MACRO_SHARED_INSTANCE_IMPLEMENTATION(JSPreviewManager)

#define PREVIEW_HEIGHT 139

- (void)showPreView
{
    UIWindow* window = [UIApplication sharedApplication].keyWindow;
    if (_preview == nil) {
        _preview = [[JSImageAddPreView alloc] initWithFrame:CGRectMake(0, window.frame.size.height - PREVIEW_HEIGHT, window.frame.size.width, PREVIEW_HEIGHT)];
        [window addSubview:_preview];
    }
    if (!_preview.isHidden) {
        return;
    }
    [UIView animateWithDuration:0.2
                          delay:0.1
                        options:UIViewAnimationOptionCurveEaseInOut
                     animations:^{
                         [_preview setAlpha:1];
                     } completion:^(BOOL finished) {
                         
                     }];
    [_preview setHidden:NO];
}


- (void)hiddenPreView
{
    [_preview setHidden:YES];
    //    [UIView animateWithDuration:0.1
    //                          delay:0
    //                        options:UIViewAnimationOptionCurveEaseInOut
    //                     animations:^{
    //                         [_preview setAlpha:0];
    //                     } completion:^(BOOL finished) {
    //
    //                     }];
    
}

- (void)resetPreView
{
    [_preview reMoveAllResource];
}

- (CGFloat)getPreViewHeight
{
    return PREVIEW_HEIGHT;
}
@end
